package com.xonro.common.histrans.sfeg.job.update.contarct;

import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.xonro.common.histrans.base.consts.SfegConst;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.List;

public class UpdateContractSignString implements IJob {


    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        SDK.getLogAPI().consoleInfo("开始处理合同档案申请日期问题");
        List<RowMap> maps = DBSql.getMaps("SELECT ID,CONTRACT_NO  FROM BO_XR_MDM_CONTRACT  ");

        for(RowMap m:maps){
            String contractNo=m.getString("CONTRACT_NO");
            String id=m.getString("ID");
            RowMap mainMap = SDK.getCCAPI().getRDSAPI(SfegConst.CCID).getMap("SELECT fillDate,signsj FROM tb_ContractInfo    WHERE HTBH= '" + contractNo + "'  ");
            if(null==mainMap){
                continue;
            }
            String fillDate=mainMap.getString("fillDate");
            String signsj=mainMap.getString("signsj");
            DBSql.update("UPDATE BO_XR_MDM_CONTRACT SET SIGN_DATE='"+fillDate+"', SIGN_DATE_STRING='"+signsj+"'  WHERE ID='"+id+"'"  );
        }


        SDK.getLogAPI().consoleInfo("结束处理合同档案申请日期问题==========");
    }


}
